package com.seabook.store.purchase.domain;

public class CartItem implements java.io.Serializable{

    private static final long serialVersionUID = -5719873014346327307L;
    private Item item;
    private int quantity;
    private boolean inStock;
    public Item getItem() {
        return item;
    }
    public void setItem(Item item) {
        this.item = item;
    }
    public int getQuantity() {
        return quantity;
    }
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
    public boolean isInStock() {
        return inStock;
    }
    public void setInStock(boolean inStock) {
        this.inStock = inStock;
    }
    /* Public methods */
    public double getTotalPrice() {
        if (item != null) {
            return item.getListPrice() * quantity;
        }
        else {
            return 0;
        }
    }
    public void incrementQuantity(int quantity) {
      this.quantity += quantity;
    }
}
